package co.com.jtune.model;

import java.util.ArrayList;
import java.util.List;

import co.com.jtune.persistence.TrackPersistence;
import co.com.jtune.persistence.localPersistence.LocalPersistenceTrackImpl;

public class Library {
	
	private List<TrackModel> library;
	
	public Library()
	{
		library = new ArrayList<TrackModel>();
		
		TrackPersistence persistence = LocalPersistenceTrackImpl.getTrackPersistenceInstance();
		library.addAll(persistence.loadTrackList());
	}
	
	public List<TrackModel> getTracks()
	{
		return library;
	}
	
	public void addTrackToLibrary(TrackModel track)
	{
		if (!library.contains(track))
			library.add(track);
	}
	
	public void addTrackListToLibrary(List<TrackModel> trackList)
	{
		for (TrackModel track : trackList) {
			addTrackToLibrary(track);
		}
	}
}
